﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iLangl.StateMachine;
using iLangl.Security;
using iLangl.BusinessModel.Managers;
using iLangl.Transport.Communication;
using iLangl.Model;
using iLangl.BusinessModel.DAL;

namespace iLangl.BusinessModel
{
	public class iLanlFacade : BaseFacade, IFacade
	{
		private iLanlFacade()
			: base()
		{
			if (AuthenticationService == null) { AuthenticationService = new AuthenticationService(); }
			if (ActionManager == null) { ActionManager = new BaseActionManager(); }
			if (CommunicationManager == null) { CommunicationManager = new BaseCommunicationManager(null); }
			if (PackageManager == null) { PackageManager = new PackageManager(DALFacade.Instance.PackageDAL); }
			if (StateMachine == null) { StateMachine = new BaseStateMachine(); }
			if (ModelFactory == null) { ModelFactory = new ModelFactory(); }
			if (AlertManager == null) { AlertManager = new AlertManager(); }
		}

		private static object mutex = new object();
		private static iLanlFacade _instance = null;

		public static iLanlFacade Instance
		{
			get
			{
				if (_instance == null)
				{
					lock (mutex)
					{
						if (_instance == null)
						{
							_instance = new iLanlFacade();
						}
					}
				}

				return _instance;
			}
		}





		
	}
}
